package rkdwogus7.practice;

import java.util.*;

public class Ch05_Sil5_v2 {

	public static void main(String[] args) {
		Add2 ad2 = new Add2();
		Sub2 sb2 = new Sub2();
		Mul2 mu2 = new Mul2();
		Div2 dv2 = new Div2();
		Scanner sc = new Scanner(System.in);
		System.out.println("두 수와 연산자를 입력하세요");
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.next().charAt(0);
		
		if(c == '+') {
			ad2.calculate();
		}
		else if (c == '-') {
			sb2.calculate();
		}
		else if (c == '*') {
			mu2.calculate();
		}
		else if(c == '/') {
			dv2.calculate();
		} else {
			System.out.println("잘못된 연산자를 입력하였습니다");
		}
		
	}

	
	
}

class Add2 {
	private int a;
	private int b;
	private String result = "";
	
	public void setValue(int a, int b) {
		this.a = a;
		this.b = b;
	}
	
	public int calculate() {
		return a + b;
	}
	
	@Override
	public String toString() {
		result += "두 수를 더한 값은 " + Integer.toString(a + b) + "입니다";
		return result;
	}
	
}

class Sub2 {
	private int a;
	private int b;
	private String result = "";
	
	public void setValue(int a, int b) {
		this.a = a;
		this.b = b;
	}
	
	public int calculate() {
		return a - b;
	}
	
	@Override
	public String toString() {
		result += "두 수를 더한 값은 " + Integer.toString(a - b) + "입니다";
		return result;
	}
	
}

class Mul2 {
	private int a;
	private int b;
	private String result = "";
	
	public void setValue(int a, int b) {
		this.a = a;
		this.b =b;
	}
	
	public int calculate() {
		return a * b;
	}
	
	@Override
	public String toString() {
		result += "두 수를 곱한 값은 " + Integer.toString(a * b) + "입니다";
		return result;
	}
	
}

class Div2 {
	private int a;
	private int b;
	private String result = "";
	
	public void setValue(int a, int b) {
		this.a = a;
		this.b = b;
	}
	
	public int calculate() {
		return a / b;
	}
	
	@Override
	public String toString() {
		result += "두 수를 더한 값은 " + Integer.toString(a / b) + "입니다";
		return result;
	}
}







